home *** CD-ROM | disk | FTP | other *** search
- /* PSDtext.c */
- /* This module contains the routines for bitmap operations */
- /* Copyright 1992, Gary D. McGath */
-
- #include "psd.h"
-
- pascal psdTextProc(short byteCount, Ptr textBuf, Point numer, Point denom);
- void SelectFont(void);
-
- extern int thePSFile; /* ID of file to output to */
- extern int gblFont;
- extern int gblSize;
-
- pascal psdTextProc(short byteCount, Ptr textBuf, Point numer, Point denom)
- {
- register int i;
- SelectFont(); /* determine font and issue font commands */
- OutputString("/SV save def ",thePSFile);
- OutputNum(thePort->pnLoc.h,thePSFile);
- OutputNum(thePort->pnLoc.v,thePSFile);
- OutputString("translate 1 -1 scale ",thePSFile);
- OutputString("0 0 moveto\r",thePSFile);
-
- /* The following code will fail in various cases, most notably unbalanced
- parentheses within the string. */
- OutputChar('(', thePSFile);
- for (i = 0; i < byteCount; i++)
- OutputChar(textBuf[i],thePSFile);
- OutputString(") show SV restore\r", thePSFile);
- }
-
-
- void SelectFont()
- {
- if (thePort->txFont != gblFont || thePort->txSize != gblSize) {
-
- /* "Real" code needs to look up the PostScript font name */
- OutputString("/Times-Roman findfont ",thePSFile);
- OutputNum(thePort->txSize, thePSFile);
- OutputString("scalefont setfont\r",thePSFile);
- gblFont = thePort->txFont;
- gblSize = thePort->txSize;
- }
- }
-